package com.tencent.wxcloudrun.vo.request.card;

import com.tencent.wxcloudrun.domain.TStoreCard;
import com.tencent.wxcloudrun.vo.BaseReqVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * @Author ZhaoZiYin
 * @Date 2025/4/22
 * @Description 新增卡片请求入参
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "StoreCardAddReqVo", description = "新增卡片请求入参")
public class StoreCardAddReqVo extends BaseReqVo {

    @NotBlank
    @ApiModelProperty("卡片名称")
    private String name;

    @ApiModelProperty("卡片描述")
    private String memo;

    @ApiModelProperty("卡片图片")
    private String imgUrl;

    @ApiModelProperty("申请标志")
    private Integer applyFlag;

    @ApiModelProperty("排序")
    private Integer orderNo;

    public TStoreCard build() {
        TStoreCard storeCard = new TStoreCard();
        storeCard.setName(name);
        storeCard.setMemo(memo);
        storeCard.setImgUrl(imgUrl);
        storeCard.setApplyFlag(applyFlag);
        storeCard.setOrderNo(orderNo);
        storeCard.setCreatedBy(String.valueOf(this.getUserId()));
        storeCard.setUpdatedBy(String.valueOf(this.getUserId()));
        storeCard.setCreatedTime(LocalDateTime.now());
        storeCard.setUpdatedTime(LocalDateTime.now());
        return storeCard;
    }
}
